/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.uniminuto.park.dao;


import co.uniminuto.park.clases.Roles;
import co.uniminuto.park.variables.VariablesGlobales;
import com.google.code.morphia.Datastore;
import com.google.code.morphia.Morphia;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Esteban Rozo
 */
public class insertarRolDao extends ConexionMongo{
    
    private Morphia morphia;
    private Datastore ds;

    public Morphia getMorphia() {
        return morphia;
    }

    public void setMorphia(Morphia morphia) {
        this.morphia = morphia;
    }

    public Datastore getDs() {
        return ds;
    }

    public void setDs(Datastore ds) {
        this.ds = ds;
    }
    
    public insertarRolDao(){super();}
    
    
    public void insertarEst(Roles rol){
    this.morphia= new Morphia();
    this.morphia.map(Roles.class);
    this.ds=this.morphia.createDatastore(super.conectar(), VariablesGlobales.nombreBD);
    this.ds.ensureIndexes();
    this.ds.save(rol);
    }
    
   
        public static void main(String args[]) {
            insertarRolDao in= new insertarRolDao();
            
            Roles r = new Roles();
            r.setNombreRol("Administrador");
            r.setIdRol("AD");
            in.insertarEst(r);
            //in.insertar();
            //in.recuperar();
               
           
        }
    
    
    
    
}
